<!DOCTYPE html>
<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<title th:text="|#{customer.systemTitle}-用户权限-组织机构维度|">图灵谷</title>
<div th:replace="fragments/head_admin">head</div>
</head>
<body>
	<div class="layui-layout layui-layout-admin">
		<div th:replace="fragments/nav_admin">导航栏</div>
		<div th:replace="fragments/menu_admin::menu(parent=uum,child=user)">菜单栏</div>
		<div class="layui-body">
			<div class="layui-main">
				<!--/***** 面包屑 *****/-->
				<div class="layui-elem-quote" style="margin-top: 10px;">
					<span class="layui-breadcrumb"> <a><cite>用户权限</cite></a> <a href="#">用户管理</a> <a><cite>修改密码</cite></a>
					</span>
				</div>
				<blockquote class="layui-elem-quote layui-quote-nm" style="color: #FF5722">
					<i class="layui-icon">&#xe60b;</i> 修改密码
				</blockquote>
				<form th:action="@{/admin/c/user/changePassword.gsp}" role="form" action="#" class="layui-form" method="post">
					<fieldset class="layui-elem-field layui-field-title">
						<legend>修改密码</legend>
					</fieldset>
					<div class="layui-form-item">
						<label class="layui-form-label">原密码：<span style="color: red">*</span></label>
						<div class="layui-input-block">
							<input name="oldUserPass" lay-verify="oldUserPass" required placeholder="请输入原密码" type="password" class="layui-input" maxLength="12" />
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">新密码：<span style="color: red">*</span></label>
						<div class="layui-input-block">
							<input id="userPass" name="userPass" lay-verify="userPass" required placeholder="请输入新密码" type="password" class="layui-input" maxLength="12" />
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">确认密码：<span style="color: red">*</span></label>
						<div class="layui-input-block">
							<input name="userPass2" lay-verify="userPass2" required placeholder="请确认新密码" type="password" class="layui-input" maxLength="12" />
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-form-label"></div>
						<div class="layui-input-block">
							<label id="errorMsg" class="error-this" hidden="hidden"></label>
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-input-block">
							<button class="layui-btn" lay-submit="" lay-filter="submit1">立即提交</button>
							<button type="reset" class="layui-btn layui-btn-primary">重置</button>
						</div>
					</div>
				</form>
			</div>
		</div>
		<div th:replace="fragments/footer_admin">底部</div>
	</div>
</body>
<div th:replace="fragments/import_js_admin">引入js</div>
</html>
<script th:inline="javascript">
    /*<![CDATA[*/
    var form = layui.form();
    //自定义验证规则
    form.verify({
        oldUserPass : function(value) {
            if (value.length <= 0) {
                return '请输入原密码！';
            } else if (value.length > 12) {
                return '原密码长度不能大于12个字符！';
            } else if (checkOldPass(value) == 'false') {
                return '原密码输入不正确！';
            } else if (value == $('#userPass').val()) {
                return '新密码和原密码不能相同!';
            }
        },
        userPass : function(value) {
            if (!/^[\S]{6,12}$/.test(value)) {
                return '密码必须6到12位，且不能出现空格！';
            }
        },
        userPass2 : function(value) {
            if (value.length <= 0) {
                return '再次输入密码不能为空！';
            } else if (value != $('#userPass').val()) {
                return '新密码输入不一致';
            }
        }
    });

    //判断原密码正确性
    var checkUrl = /*[[@{/admin/c/user/checkOldPass.htm}]]*/'url';
    function checkOldPass(oldPass) {
        $.ajax({
            type : "POST",
            url : checkUrl,
            async : false,
            data : {
                "oldPass" : oldPass
            },
            success : function(data) {
                result = data;
            }
        });
        return result
    }
    //监听提交
    form.on('submit(submit1)', function(data) {
    });
    /*]]>*/
</script>
